# Contributor: Adrián Arroyo Calle <adrian.arroyocalle@gmail.com>
# Maintainer: Adrián Arroyo Calle <adrian.arroyocalle@gmail.com>
pkgname=scryer-prolog
pkgver=0.9.3
pkgrel=0
pkgdesc="Modern Prolog implementation written in Rust"
url="https://github.com/mthom/scryer-prolog"
# s390x: nix crate
arch="all !s390x"
license="BSD-3-Clause"
makedepends="
	cargo
	cargo-auditable
	libffi-dev
	libsodium-dev
	m4
	openssl-dev>3
	rustfmt
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/mthom/scryer-prolog/archive/refs/tags/v$pkgver.tar.gz
	use-system-libffi.patch
	cargo-lock-version.patch
	ring-0.17.5.patch
	"

# system libs
export OPENSSL_NO_VENDOR=1
export CARGO_FEATURE_USE_SYSTEM_LIBS=1
export SODIUM_USE_PKG_CONFIG=1


prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --release --frozen
}

check() {
	cargo test --frozen
}

package() {
	install -Dm755 target/release/scryer-prolog -t "$pkgdir"/usr/bin
}

sha512sums="
0ecf833fe9c642c04114eaa923ed3f984892cbb202b7f0fd1d2d48c8ab260297e5b516a552511d03cc4a408eae852150e9c97c6eab4c8220668417f082f97de3  scryer-prolog-0.9.3.tar.gz
c708062ffaa6c108927592dd677b5dec2fe908d2b77cda0ecd710f4906002b984d8c1dd492a0a0c4a39a403e26eab31c8448664b92ca6ed3ba216988369d1dad  use-system-libffi.patch
d8ebba2dcabd8074277430ba31b547a347d261f487a765d05f0d7c26bd62641ec4756eba1186b326de768dff6cd2a226c3c15f6ba361e5dbfc441da1ccf11215  cargo-lock-version.patch
99a10529cb96e286a3f50cd7b6d41051cddd76dd75da8b565146f227131a3108f84d520688f70539c111929cdd22a4312b6ed32527c2797a9ac88f875a189eb0  ring-0.17.5.patch
"
